<h1>Pohon Jaringan</h1>
<?php
$message = '';
?>
<style>
    /* AWAL TREE */
    .tree { width:696px; overflow:auto; }
    .tree { padding:10px 0; font-size:7pt; }
    .tree .box { border-collapse: collapse; margin:0; padding:0; border:2px solid #999; background:#eee; }
    .tree .box-1, .tree .box-passive { border-collapse: collapse; margin:0; padding:0; border:2px solid #999; background:#eee; }
    .tree .box-2, .tree .box-distributor { border-collapse: collapse; margin:0; padding:0; border:2px solid #848485; background:#a6a6a8; }
    .tree .box-4, .tree .box-factory { border-collapse: collapse; margin:0; padding:0; border:2px solid #947a32; background:#c4a348; }
    .tree .box-3, .tree .box-warehouse { border-collapse: collapse; margin:0; padding:0; border:2px solid #4d5f8a; background:#8297c8; }
    .tree .box td, .tree .box-1 td, .tree .box-2 td, .tree .box-3 td, .tree .box-4 td { text-align:center; padding:3px 0px !important; }
    .tree .box-passive td, .tree .box-distributor td, .tree .box-warehouse td, .tree .box-factory td { text-align:center; padding:3px 0px !important; }
    .tree th { text-align:center; margin:0; padding:0; }
    .tree td { font-family:verdana, Arial, Helvetica, sans-serif; padding:0 1px; }
    .tree .line-top {border-top:1px solid #999; }
    .tree .line-right { border-right:1px solid #999; }
    .tree .line-bottom { border-bottom:1px solid #999; }
    .tree .line-left { border-left:1px solid #999; }
    .tree .no-line-top {border-top:1px solid #fff !important; }

    .tree .mid { font-weight:bold; color:#900; font-size:7pt; }
    .tree .mid a { font-weight:bold; color:#a00; font-size:7pt; }
    .tree .box-1 .mid a, .tree .box-passive .mid a { font-weight:bold; color:#a00; }
    .tree .box-2 .mid a, .tree .box-distributor .mid a { font-weight:bold; color:#fff; }
    .tree .box-3 .mid a, .tree .box-warehouse .mid a { font-weight:bold; color:#fff; }
    .tree .box-4 .mid a, .tree .box-factory .mid a { font-weight:bold; color:#fff; }
    .tree .data { font-weight:normal; color:#222; font-size:6pt; }
    .tree .box-1 .data, .tree .box-passive .data { font-weight:normal; color:#222; font-size:7pt; }
    .tree .box-2 .data, .tree .box-distributor .data { font-weight:normal; color:#fff; font-size:7pt; }
    .tree .box-3 .data, .tree .box-warehouse .data { font-weight:normal; color:#fff; font-size:7pt; }
    .tree .box-4 .data, .tree .box-factory .data { font-weight:normal; color:#fff; font-size:7pt; }
    .tree .node { font-weight:bold; color:#036; font-size:6pt; }
    .tree .box-1 .node, .tree .box-passive .node { font-weight:bold; color:#036; font-size:6pt; }
    .tree .box-2 .node, .tree .box-distributor .node { font-weight:bold; color:#fff; font-size:6pt; }
    .tree .box-3 .node, .tree .box-warehouse .node { font-weight:bold; color:#fff; font-size:6pt; }
    .tree .box-4 .node, .tree .box-factory .node { font-weight:bold; color:#fff; font-size:6pt; }
    .tree .up-next a { padding:5px 0; color:#aaa; font-weight:bold; text-decoration:none; }
    .tree .up-next a:hover { color:#aaa; text-decoration:none; }

    .tree a.bLink { color:#036; font-weight:bold; text-decoration:none; }
    .tree a.bLink:hover { color:#e6f1fd; text-decoration:underline; }
    .tree a.cloneLink { color:#fc0; font-weight:bold; text-decoration:none; }
    .tree a.cloneLink:hover { color:#fc0; text-decoration:underline; }
    .tree a.nextLink { color:#d00; font-weight:bold; text-decoration:none; }
    .tree a.nextLink:hover { color:#d00; text-decoration:underline; }
    /* AKHIR TREE */
</style>
<?php echo $message; ?>
<?php
if (($data[1]['member_image'] == '') || ($data[1]['member_image'] != '' && !file_exists(Yii::app()->params['config']['updir']['member'] . $data[1]['member_image'])))
    $member_image = '_default.jpg';
else
    $member_image = $data[1]['member_image'];
?>
<div class="list">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th colspan="2">Info Member</th>
        </tr>
        <tr>
            <td width="100" align="center"><?php echo CHtml::image(Yii::app()->params['config']['dir']['member'] . $member_image, (($member_image != null) ? $member_image : ''), array('width' => 75, 'style' => 'border:1px solid #ccc; padding:3px;')); ?></td>
            <td valign="top">
                <strong><?php echo $data[1]['network_mid']; ?></strong><br />
                <?php echo $data[1]['member_name']; ?><br />
                <?php echo function_lib::get_area_name($data[1]['member_city_id']); ?>, <?php echo function_lib::get_area_name($data[1]['member_state_id']); ?><br />
                Sponsor : <?php echo function_lib::get_network_mid($data[1]['network_sponsor_network_id']); ?><br />
                Upline : <?php echo function_lib::get_network_mid($data[1]['network_upline_network_id']); ?><br />
            </td>
        </tr>
    </table>
</div>
<br />
<div class="add">
    <form action="<?php echo Yii::app()->baseUrl; ?>/member/binary/geneology" method="post" name="member_form">
        <table cellpadding="0" cellspacing="0">
            <tr class="title">
                <th colspan="4" style="text-align:left;"><strong>PENCARIAN DOWNLINE</strong></th>
            </tr>
            <tr>
                <th width="100">ID Member</th>
                <td><input type="text" name="network_mid" value="<?php if(isset($_POST['network_mid'])) echo $_POST['network_mid']; ?>" size="30" class="text" />&nbsp;&nbsp;<input type="submit" name="search" class="button" value="Cari" /></td>
            </tr>
        </table>
    </form>
</div>
<br />
<br />
<div class="tree">
    <table border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
            <td width="43.75%" colspan="7"></td>
            <td width="12.5%" colspan="2" align="center" class="up-next">
                <?php
                if ($top_id > Yii::app()->user->getState('network_id'))
                    echo '<a href="' . Yii::app()->baseUrl . '/member/binary/geneology/' . function_lib::get_network_mid($data[1]['network_upline_network_id']) . '">UP</a>';
                ?>
            </td>
            <td width="43.75%" colspan="7"></td>
        </tr>
        <tr>
            <td width="43.75%" colspan="7"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[1]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[1]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[1]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[1]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="43.75%" colspan="7"></td>
        </tr>
        <tr>
            <td width="50%" colspan="8" height="10" class="line-right"></td>
            <td width="50%" colspan="8"></td>
        </tr>
        <tr>
            <td width="25%" colspan="4" height="10" class="line-right"></td>
            <td width="50%" colspan="8" class="line-top"></td>
            <td width="25%" colspan="4" class="line-left no-line-top"></td>
        </tr>
        <tr>
            <td width="18.75%" colspan="3"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[2]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[2]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[2]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[2]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="37.5%" colspan="6"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[3]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[3]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[3]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[3]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="18.75%" colspan="3"></td>
        </tr>
        <tr>
            <td width="25%" colspan="4" height="10" class="line-right"></td>
            <td width="50%" colspan="8"></td>
            <td width="25%" colspan="4" class="line-left"></td>
        </tr>
        <tr>
            <td width="12.5%" colspan="2" height="10" class="line-right"></td>
            <td width="25%" colspan="4" class="line-top"></td>
            <td width="25%" colspan="4" class="line-right line-left no-line-top"></td>
            <td width="25%" colspan="4" class="line-top"></td>
            <td width="12.5%" colspan="2" class="line-left no-line-top"></td>
        </tr>
        <tr>
            <td width="6.25%"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[4]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[4]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[4]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[4]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[5]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[5]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[5]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[5]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[6]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[6]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[6]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[6]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2"></td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[7]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[7]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[7]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[7]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="6.25%"></td>
        </tr>
        <tr>
            <td width="12.5%" colspan="2" height="10"></td>
            <td width="25%" colspan="4" class="line-right line-left"></td>
            <td width="25%" colspan="4"></td>
            <td width="25%" colspan="4" class="line-right line-left"></td>
            <td width="12.5%" colspan="2"></td>
        </tr>
        <tr>
            <td width="6.25%" class="line-right"></td>
            <td width="12.5%" colspan="2" height="10" class="line-top"></td>
            <td width="12.5%" colspan="2" class="line-right line-left no-line-top"></td>
            <td width="12.5%" colspan="2" class="line-top"></td>
            <td width="12.5%" colspan="2" class="line-right line-left no-line-top"></td>
            <td width="12.5%" colspan="2" class="line-top"></td>
            <td width="12.5%" colspan="2" class="line-right line-left no-line-top"></td>
            <td width="12.5%" colspan="2" class="line-top"></td>
            <td width="6.25%" class="line-left no-line-top"></td>
        </tr>
        <tr>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[8]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[8]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[8]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[8]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[9]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[9]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[9]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[9]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[10]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[10]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[10]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[10]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[11]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[11]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[11]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[11]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[12]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[12]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[12]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[12]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[13]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[13]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[13]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[13]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[14]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[14]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[14]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[14]['member_node']; ?></td></tr>
                </table>
            </td>
            <td width="12.5%" colspan="2" align="center">
                <table class="<?php echo $data[15]['box_class']; ?>" border="0" cellpadding="0" cellspacing="0" width="100%" height="120">
                    <tr><td class="mid"><?php echo $data[15]['member_mid']; ?></td></tr>
                    <tr><td class="data"><?php echo $data[15]['member_info']; ?></td></tr>
                    <tr><td class="node"><?php echo $data[15]['member_node']; ?></td></tr>
                </table>
            </td>
        </tr>
    </table>
</div>